package net.hzlj.platform.enterprise.activity;

import android.Manifest;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.TextView;

import net.hzlj.platform.enterprise.AppManager;
import net.hzlj.rl.zhangjiajie.R;
import net.hzlj.platform.enterprise.utils.CommonUtils;
import net.hzlj.platform.enterprise.widght.TitleBar;

import butterknife.BindView;
import butterknife.OnClick;

//http://www.mobile-open.com/2015/42482.html
//https://guides.codepath.com/android/Using-the-App-ToolBar
//http://www.jianshu.com/p/ae0013a4f71a
public class AboutActivity extends BaseActivity {

    @BindView(R.id.title_bar)
    TitleBar mTitleBar;
    @BindView(R.id.company_textView)
    TextView mCompanyTextView;
    @BindView(R.id.phone_textView)
    TextView mPhoneTextView;
    @BindView(R.id.version_textView)
    TextView mVersionTextView;

    private MyHandler<AboutActivity> mHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void setRootView() {
        super.setRootView();
        setContentView(R.layout.activity_about);
    }

    @Override
    protected void initTitleBar() {
        super.initTitleBar();
        mHandler = new MyHandler<AboutActivity>(this);
        mTitleBar.bindActivity(this);
        mTitleBar.setOnMainRightClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        }, "保存", 0, View.INVISIBLE);
        mTitleBar.setOnMainLeftClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppManager.getAppManager().finishActivity(AboutActivity.this);
            }
        }, "返回", 0, View.VISIBLE);
    }

    @Override
    protected void initWidget() {
        super.initWidget();
    }

    @Override
    protected void initData() {
        super.initData();
        mVersionTextView.setText(CommonUtils.getVersionName(this));
    }


    @Override
    void handleMessage(BaseActivity activity, Message msg) {

    }

//    @OnClick({R.id.phone_textView})
//    public void onClick(View view) {
//        switch (view.getId()){
//            case R.id.phone_textView:
//                if (selfPermissionGranted(Manifest.permission.CALL_PHONE)) {
//                    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + getString(R.string.company_phone)));
//                    startActivity(intent);
//                }
//                break;
//        }
//    }

}
